import { createRouter, createWebHistory } from 'vue-router'
// import Index from '../views/index.vue'
const Index = () => import('../views/index.vue')
import {  qiankunWindow } from 'vite-plugin-qiankun/dist/helper';
// 这里是个坑  ， 在独立访问子工程时要有 base , 在 不独立时，就不要有 base 了
// 官网说的好隐蔽呀
let base ;
if(!qiankunWindow.__POWERED_BY_QIANKUN__){
  base = import.meta.env.BASE_URL
} else {
  base = '/userApp'
}
console.log(`import.meta.env.BASE_URL: ${import.meta.env.BASE_URL}, base: ${base}, qiankunWindow.__POWERED_BY_QIANKUN__: ${qiankunWindow.__POWERED_BY_QIANKUN__}`)
const router = createRouter({
  history: createWebHistory(base),
  routes: [
    {
      path: "/",
      component: Index
    },
  ]
})

export default router
